//
//  KeyBoardModule.m
//  HKLibKeyboard
//
//  Created by 胡锦涛 on 2021/1/6.
//

#import "KeyBoardModule.h"
#import <IQKeyboardManager/IQKeyboardManager.h>


@implementation KeyBoardModule
+ (void)load {
    BFRegister(LibKeyBoardService);
}

#pragma mark - BifrostModuleProtocol
+ (instancetype)sharedInstance {
    static KeyBoardModule *instance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [[self alloc] init];
    });
    return instance;
}

- (void)setup {
    
}
//TODO:通过此方法设置Module执行的优先级
+ (NSUInteger)priority {
    return BifrostModuleDefaultPriority; //higher priority than other modules
}

+ (BOOL)setupModuleSynchronously {
    return YES;
}

#pragma mark - UIApplicationDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    //键盘管理类初始化
    //IQKeyboardManager初始化配置
    [IQKeyboardManager sharedManager].placeholderFont = [UIFont systemFontOfSize:17];
    [IQKeyboardManager sharedManager].toolbarDoneBarButtonItemText = @"完成";
    [IQKeyboardManager sharedManager].shouldToolbarUsesTextFieldTintColor = YES;
    [IQKeyboardManager sharedManager].toolbarBarTintColor = [UIColor whiteColor];
    //键盘上方按钮
    [[IQKeyboardManager sharedManager] setEnableAutoToolbar:NO];
    //点击输入框外部 消失响应
    [[IQKeyboardManager sharedManager] setShouldResignOnTouchOutside:YES];
    [IQKeyboardManager sharedManager].toolbarTintColor = [UIColor blueColor];
    return YES;
}
@end
